<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="__STATIC__/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="__CSS__/global.css" media="all">
		<link rel="stylesheet" href="__STATIC__/plugins/font-awesome/css/font-awesome.min.css">
		<link rel="stylesheet" href="__CSS__/table.css" />
	</head>

	<body>


		<div style="border-style: solid; border-width: 1px;border-color: #CCC">
			<h3 style="background-color: #f0ffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;筛选</h3>
			<br>
			<form action="__ADMIN__/team/adduser" method="post">
			<div class="layui-form-item">
					<label class="layui-form-label">工号:</label>
					<div class="layui-input-block">
						<input name="id" lay-verify="title" id='id' autocomplete="off" placeholder="" value="{$id}" class="layui-input" type="text">
				  	<div id="logo_img"></div>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">昵称:</label>
					<div class="layui-input-block">
						<input name="nickname" lay-verify="title" id='nickname' autocomplete="off" placeholder="" value="{$nickname}" class="layui-input" type="text">
				  	<div id="logo_img"></div>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">电话:</label>
					<div class="layui-input-block">
						<input name="phone" lay-verify="title" id='phone' autocomplete="off" placeholder="" value="{$phone}" class="layui-input" type="text">
				  	<div id="logo_img"></div>
					</div>
				</div>
				  <div class="layui-input-block">
					<input type="submit" class="layui-btn" value="提交">
				</div>
			</form>
		</div>
		<br>
			<fieldset class="layui-elem-field">
				<legend>数据列表</legend>
				<div class="layui-field-box">
					<table class="site-table table-hover">
						<thead>
							<tr>
								<th>工号</th>
								<th>姓名</th>
								<th>头像</th>
								<th>微信号</th>
								<th>手机号</th>
								<th>身份证</th>
								<th>身份</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody id ="tbody">					
						</tbody>
					</table>
							<div id="page"></div>
	
				</div>
			</fieldset>
	</body>

			<script type="text/javascript" src="__STATIC__/plugins/layui/layui.js"></script>
			<script type="text/javascript" src="__STATIC__/datas/nav.js"></script>	
			<script src="__JS__/index.js"></script>
		    <script src="__JS__/jquery.js"></script>

	</html>
		<script>
			layui.config({
				base: '__STATIC__/plugins/layui/modules/'
			});
			layui.use(['laypage', 'layer'], function(){
				  var laypage = layui.laypage;
				  var id = $("#id").val();
				  var nickname = $("#nickname").val();
				  var phone = $("#phone").val();
				  var level = $("#level").val();
				  var yewuy = $("#yewuy").val();
				    laypage.render({
					    elem: 'page'
					    ,count: {$count} //数据总数
					    ,limit:20
					    ,jump: function(obj){
					     	$.ajax({
					     		type:"post",
					     		url:"__ADMIN__/team/adduser",
					     		data:{
					     			page:obj.curr,
					     			id:id,
					     			nickname:nickname,
					     			phone:phone,
					     			level:level,
					     			yewuy:yewuy
					     		},
					     		dataType:"json",
					     		success:function(res){
					     			var table =  "";
					     			for(var a = 0 ;a<res.length;a++){
					     				// alert(res.length);
					     				 table+= '<tr>';
					     				 table+= '<td>'+res[a].uid+'</td>';
					     				 table+= '<td>'+res[a].name+'</td>';
					     				 table+= '<td><img width="30px" src="'+res[a].avatar+'"></td>';
					     				 table+= '<td>'+res[a].weixin+'</td>';
					     				 table+= '<td>'+res[a].phone+'</td>';
					     				 table+= '<td>'+res[a].idcard+'</td>';
					     				 table+= '<td>'+res[a].power+'</td>';
					     				 table+= '<td><a href="javascript:void(0)" class="layui-btn layui-btn-danger add" src = '+res[a].uid+'>设为团队</a></td>';
					     				 table+= '</tr>';

			
					     			}
					     			 $("#tbody").html(table);

					     		}
					     	})
					    }
					  });

			$(document).on("click",".add",function(){
					var obj = $(this);
					var id = $(this).attr("src");
					layer.confirm('是否设置为团队', {
						btn: ['是','否'] //按钮
						}, function(){
							$.ajax({
								type:"post",
								url:"__ADMIN__/team/dl",
								data:{id:id},
								dataType:"json",
								success:function(res){
							 layer.msg('设置成功', {icon: 1});
								location.href = "__ADMIN__/team/index"
								}
							})
						})
			})



			})
		</script>